package se.webbzon.boltzmann.battle.round;

import se.webbzon.boltzmann.battle.group.BattleGroup;
import se.webbzon.boltzmann.battle.group.BattleGroupListener;
import se.webbzon.boltzmann.battle.object.npc.BattleNPC;
import se.webbzon.oschi01.friendly.Friendly;

@Friendly class BattleRoundBattleGroupListener implements BattleGroupListener {

	// The battle round associated with this listener
	private final BattleRound battleRound;
	
	/*============================================================
	Constructors
	============================================================*/
	
	/** Creates a new battle group listener for the battle round. **/
	@Friendly BattleRoundBattleGroupListener(BattleRound battleRound) {
		this.battleRound = battleRound;
	}
	
	/*============================================================
	Public Methods
	============================================================*/
	
	@Override public void onAddParticipant(	BattleGroup group, 
											BattleNPC participant) {};

	@Override public void onRemoveParticipant(	BattleGroup group, 
												BattleNPC participant) {
		if (group.participants() == 0)
			battleRound.removeGroup(group);
	}

}
